<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="/css/pintuer.css">
<link rel="stylesheet" href="/css/admin.css">
<script src="/js/jquery.js"></script>
<script src="/js/pintuer.js"></script>
</head>
<style media="screen">
  #anniu{
    width:200px;
    height:100px;
    margin:0 auto;
  }
  select{
    width:200px;
    height:45px;
    border:1px solid #ddd;
    border-radius:3px;
  }
</style>
<body>
<div class="panel admin-panel">
  <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span>增加内容</strong></div>
  <div class="body-content">
    <form method="post" class="form-x" action="{{url('tijiao')}}">
      {!!csrf_field()!!}

      <div class="form-group">
        <div class="label">
          <label>品牌:</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" value="{{$c->brand_name}}" name="brand_name" data-validate="required:请输入品牌" />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>车系:</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" value="{{$c->series_name}}" name="series_name" data-validate="required:请输入车系" />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>排量:</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" value="{{$c->emission}}" name="emission" data-validate="required:请输入排量" />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>年款:</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" value="{{$c->year_type}}" name="year_type" data-validate="required:请输入年款" />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>款式:</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" value="" name="type" data-validate="required:请输入款式" />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>标价:</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" value="{{$c->price}}" name="price" data-validate="required:请输入标价" />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>上牌时间:</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" value="{{$c->reg_time}}" name="reg_time" data-validate="required:请输入上牌时间" />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>行驶里程:</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" value="{{$c->mileage}}" name="mileage" data-validate="required:请输入行驶里程" />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>牌照地:</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" value="{{$c->license_addr}}" name="license_addr" data-validate="required:请输入牌照地" />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>验车省份/直辖市:</label>
        </div>
      <select id="pro"  name="pro"></select>
      &nbsp;验车城市:&nbsp;&nbsp;
      <select  name="city" id="city"></select>
      </div>
      <div class="form-group">
        <div class="label">
          <label>验车地址:</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" value="{{$c->checkcar_addr}}" name="checkcar_addr" data-validate="required:请输入验车地址" />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>卖家说明：</label>
        </div>
        <div class="field">
          <input class="input" name="seller_intro" value="{{$c->seller_intro}}" style=" height:90px;"></input>
          <div class="tips"></div>
        </div>
      </div>
        <input type="hidden" name="car_id" value="{{$c->car_id}}">
        <div id='anniu'>
          <div class="field">
            <button class="button bg-main icon-check-square-o" type="submit"> 提交</button>
          </div>
        </div>
      </div>

    </form>
  </div>
</div>

</body>
<script type="text/javascript">
        var pro = document.getElementById('pro');
        var pros = [
'请选择省份','北京', '上海', '安徽','辽宁','河南','河北' ,'内蒙古', '山东','天津','吉林', '湖南', '山西', '江苏', '黑龙江','四川','广东', '福建','重庆','江西','广西','贵州','湖北','浙江','云南','甘肃','新疆','陕西','宁夏'];
        var gloBal = 0;//定义一个全局变量,把数据库的名称等于这边遍历出来的i值记录下来
        var proStr = '';
        for(var i = 0;i < pros.length;i++){
            if ("{{$c->checkcar_pro}}" == pros[i]){
                gloBal = i;
                proStr += '<option ' + 'selected ' + 'value=' + i + '>' + pros[i] + '</option>';
            }else{
                proStr += '<option '+ 'value='+ i + '>' + pros[i] + '</option>';
            }


        }
        pro.innerHTML = proStr;

        var citys = [
         [],
         ['北京'],
         ['上海'],
         ['安庆','蚌埠','阜阳','合肥','六安','马鞍山','铜陵','芜湖'],
         ['鞍山','大连','抚顺','锦州','辽阳','沈阳','瓦房店','营口'],
         ['安阳','焦作','开封','洛阳','南阳','新乡','信阳','许昌','郑州','驻马店'],
         ['保定','沧州','承德','邯郸','衡水','廊坊','秦皇岛','石家庄','唐山','邢台'],
         ['包头','鄂尔多斯','呼伦贝尔'],
         ['滨州','德州','东营','菏泽','济南','济宁','聊城','临沂','平度','青岛','日照','泰安','潍坊','威海','烟台','枣庄','淄博'],
         ['宝坻','滨海新区','大港','汉沽','静海','津南','塘沽','武清'],
         ['长春','吉林','松原'],
         ['常德','长沙','湘潭','岳阳','株洲'],
         ['长治','大同','临汾','太原','运城'],
         ['常州','常熟','淮安','江阴','昆山','南京','南通','宿迁','泰州','太仓','无锡','吴江','徐州','盐城','扬州','宜兴','镇江','张家港','苏州'],
         ['大庆','哈尔滨','佳木斯','齐齐哈尔'],
         ['达州','德阳','广安','乐山','泸州','眉山','绵阳','南充','内江','遂宁','宜宾','自贡','资阳','成都'],
         ['东莞','佛山','惠州','江门','汕头','中山','珠海','广州','深圳'],
         ['福州','莆田','泉州','厦门','漳州'],
         ['涪陵','合川','开县','万州','永川','云阳'],
         ['赣州','吉安','南昌','宜春'],
         ['桂林','柳州','南宁'],
         ['贵阳'],
         ['黄冈','黄石','荆州','十堰','武汉','襄阳','孝感','宜昌','武汉'],
         ['湖州','嘉兴','金华','宁波','衢州','绍兴','台州','温州','杭州'],
         ['昆明','曲靖'],
         ['兰州'],
         ['乌鲁木齐'],
         ['西安'],
         ['银川'],
        ];
        var city = document.getElementById('city');
        var cityStr = '';
        for(var i = 1;i < citys.length;i++){
            for(var j = 0;j < citys[i].length;j++){
                if("{{$c->checkcar_city}}" == citys[gloBal][j]){
                     cityStr += '<option selected>' + citys[gloBal][j] + '</option>';
                }else{
                    cityStr += '<option>' + citys[gloBal][j] + '</option>';
                }
            }

        }
        city.innerHTML = cityStr;
        window.onload = function()
        {
            pro.onchange = function(ev)
            {

                 var specified = citys[pro.value];
                 var Str = '';
                 for(var i = 0;i < specified.length;i++){
                     Str += '<option>' + specified[i] + '</option>';
                 }
                 city.innerHTML = Str;
            }
        }
</script>
</html>
